import request from '@/utils/request'

// 获取数据列表
export function fetchList(query) {
  return request({
    url: '/sys/role/list',
    method: 'post',
    data: query
  })
}

// 新增
export function add(item) {
  return request({
    url: '/sys/role/add',
    method: 'post',
    data: item
  })
}

// 修改
export function update(item) {
  return request({
    url: '/sys/role/update',
    method: 'post',
    data: item
  })
}

// 删除
export function del(item) {
  return request({
    url: '/sys/role/delete',
    method: 'post',
    data: { id: item }
  })
}

// 获取已分配权限数据
export function getAssignedPermission(query) {
  return request({
    url: '/sys/role/permission/list',
    method: 'post',
    data: query
  })
}

// 保存角色权限关联
export function savePermissionAssign(items) {
  return request({
    url: '/sys/role/permission/add-list',
    method: 'post',
    data: items
  })
}
